/*
 * cc.h
 *
 *  Created on: Aug 1, 2013
 *      Author: Ken Arok
 *
 *      Revision history:
 *      ---------------------------------------------------------
 *      Date			|	Revised by		|	Description
 *      ---------------------------------------------------------
 *      1. Aug 1, 2013	|	Yosef			| New establishment
 *
 *
 *
 * \brief Basic header that describes the compiler and AVR32 UC3 to lwIP.
 *
 * Copyright (c) 2013 PT Hanindo Automation Solutions. All rights reserved.
 *
 */


#ifndef CC_H_
#define CC_H_

#include "config_board.h"

#if BOARD_1_0_USED

/* Include some files for defining library routines */
/* #include <string.h>
#include <sys/time.h>*/

/* Define platform endianness */
#ifndef BYTE_ORDER
#define BYTE_ORDER BIG_ENDIAN
#endif /* BYTE_ORDER */

/* Define generic types used in lwIP */
typedef unsigned char	u8_t;
typedef signed char    	s8_t;
typedef unsigned short	u16_t;
typedef signed short	s16_t;
typedef unsigned long	u32_t;
typedef signed long		s32_t;

typedef u32_t mem_ptr_t;

/* Define (sn)printf formatters for these lwIP types */
#define U16_F "hu"
#define S16_F "hd"
#define X16_F "hx"
#define U32_F "lu"
#define S32_F "ld"
#define X32_F "lx"

/* Compiler hints for packing structures */
#define PACK_STRUCT_FIELD(x)	x
#define PACK_STRUCT_STRUCT __attribute__ ((__packed__))
#define PACK_STRUCT_BEGIN
#define PACK_STRUCT_END

/* define LWIP_COMPAT_MUTEX
    to let sys.h use binary semaphores instead of mutexes - as before in 1.3.2
    Refer CHANGELOG
*/
#define  LWIP_COMPAT_MUTEX  1

/* Platform specific diagnostic output */

/* Include some files for defining library routines */

/*
#include <stdio.h>
#include "lwipopts.h"
#include "print_funcs.h"
#define LWIP_PLATFORM_DIAG(x) { char tmpbuf[256];sprintf(tmpbuf,(const char *)x);print_dbg((const char *)tmpbuf);}
*/
#define LWIP_PLATFORM_DIAG(x)

#define LWIP_PLATFORM_ASSERT(x) do {/*printf("Assertion \"%s\" failed at line %d in %s\n", x, __LINE__, __FILE__); \
                                      fflush(NULL); abort();*/} while(0)

#define LWIP_PROVIDE_ERRNO // Make lwip/arch.h define the codes which are used throughout.

#endif /* BOARD_1_0_USED */

#endif /* CC_H_ */
